package Month10.day1017;

public class one {
    //1. 两数之和
    public static int[] twoSum(int[] nums, int target) {
        int[] array = new int[2];
        for(int i = 0;i < nums.length - 1;i++){
            for(int j = i + 1;j < nums.length;j ++){
                if(nums[i] + nums[j] == target){
                    array[0] = i;
                    array[1] = j;
                    return array;
                }
            }
        }
        return null;
    }

    public static void main(String[] args) {
        int[] a = new int[]{3,2,4};
        int[] b = twoSum(a,6);
        for(int i = 0;i < b.length;i++){
            System.out.print(b[i] + " ");
        }
    }
}
